home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue10.arc / TVWNREAD.C < prev    next >
C/C++ Source or Header  |  1988-08-13  |  1KB  |  41 lines

  1. /*================================================*/
  2. /* TVWNREAD.C                                     */
  3. /*                                                */
  4. /* (c) Copyright 1988 Ralf Brown                  */
  5. /*     All Rights Reserved                        */
  6. /* May be freely copied for noncommercial use as  */
  7. /* long as this copyright notice is kept intact   */
  8. /* and any changes are indicated in the comment   */
  9. /* blocks for the functions                       */
  10. /*================================================*/
  11.  
  12. #include <stdio.h>
  13. #include "tvapi.h"
  14.  
  15. /*================================================*/
  16. /* TVwin_nread  read next N chars from window     */
  17. /*   Ralf Brown 4/3/88                            */
  18. /*================================================*/
  19.  
  20. int pascal TVwin_nread(OBJECT win,void *buffer,int n)
  21. {
  22.    PARMLIST3 p ;  /* returns width-of-screen/addr/count */
  23.    register int count ;
  24.  
  25.    if (buffer == NULL)
  26.       return 0 ;
  27.    p.num_args = 1 ;
  28.    n-- ;  /* reserve space for null to terminate string */
  29.    p.arg[0] = (DWORD) n ;
  30.    TVsendmsg(READ_MSG, win?TOS:ME, win, (PARMLIST *)&p) ;
  31.    count = (int) p.arg[0] ;
  32.    if (count > n)
  33.       count = n ;
  34.    while (count--)
  35.       *((char *)buffer)++ = *((char far *)p.arg[1])++ ;
  36.    *((char *)buffer) = '\0' ;
  37.    return (int) p.arg[0] ;
  38. }
  39.  
  40. /* End of TVWNREAD.C */
  41.